<template>
  <div style="margin: 5%;">
    <a-input-search
          v-model="phone"
          placeholder="请输入手机号码查询"
          enter-button="Search"
          size="large"
          @search="onSearch"
        />
      
    <div v-if="flag">
      <p slot="content" style="text-align: center;margin-top: 5%;font-size: 1.25em;">
            优待服务申请：
          </p>
      <p slot="content" style="text-align: center;margin-top: 5%;font-size: 1.25em;">
            {{service}}
          </p>
      <p slot="content" style="text-align: center;margin-top: 5%;font-size: 1.25em;">
            活动申请：
          </p>
      <p slot="content" style="text-align: center;margin-top: 5%;font-size: 1.25em;">
            {{activity}}
          </p>
    </div>  

  </div>     
</template>


<script>

  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'

  export default {
    name: 'search',
    data () {
      return {
        service:'',
        activity:'',
        phone:'',
        flag:false,
        url: {
          search: "/veterans/sysActivities/search"
        }
      }
    },
    methods: {
      onSearch(){
        getAction(this.url.search,{phone:this.phone}).then((res) => {
          //console.log(JSON.stringify(res))
          if (res.success) {
            this.flag = true
            this.activity = res.result.activity;
            this.service = res.result.service;
          }else{
            this.$message.error(res.message);
          }
        }).catch(error => {
            this.$message.error(res.message);
        });
      }
    }
  }
</script>